<?php 

var_dump($_POST);
session_start();

$_POST['pwd']=md5($_POST['pwd']);
$_POST['rpwd']=md5($_POST['rpwd']);

if ($_POST['user']=='' || $_POST['pwd']=='' || $_POST['yzm']=='' || $_POST['email' == '']) {
	echo '<script>alert("请填写完整的信息");window.location.href="register.php"</script>';die;
}
if ($_POST['pwd'] != $_POST['rpwd']) {
	echo "<script>
     alert('两次密码输入不一致请重新注册');window.location.href='register.php'</script>";die;
}

if(strtolower($_POST['yzm']) != strtolower($_SESSION['yzm'])){
	echo '<script>alert("验证码错误");window.location.href="register.php"</script>';die;

}



include_once('../../public/function.php');
  $config = include_once('../../public/config.php');
  $aa['user']=$_POST['user'];
  $aa['pwd']=$_POST['pwd'];
  $aa['email']=$_POST['email'];
  $res =add($config,'user',$aa);

 if ($res){
     echo "<script>
     alert('注册成功');window.location.href='../../index.php'</script>";
 }else{
 	echo "<script>
     alert('注册失败');window.location.href='register.php'</script>";
 }



 ?>